﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZF.BLL;
using GCELibrary.Current;
using ZF.BLL.ServiceModel;

namespace ZF.WS.service.btc
{
    public partial class zh : bopcontrol
    {


        protected void Page_Load(object sender, EventArgs e)
        {
            this.AirHtml1.Text = BConfig.ZG;
            InitControls();
        }


        public void InitControls()
        {
           
        }

        public void Add()
        {
            InitControls();

        }
        public void AddSubmit(object sender, EventArgs e)
        {


            using (var dc = SiteInfo.CreateDBDataContext())
            {


                var news = new ZF.Model.I_News()
                {
                    AddTime = DateTime.Now,
                    Author = this.tbAuthor.Text,
                    Content = this.FCKeditor1.Value,
                    ComeFrom = this.tbFrom.Text,
                    Hits = 0,
                    Title = this.tbTitle.Text,
                    Type = this.ddlType.SelectedValue,
                    IsV = false,
                    PuberId = SiteInfo.GetCurrentMember() != null ? SiteInfo.GetCurrentMember().MemberId : 0
                };


                try
                {
                    dc.I_News.InsertOnSubmit(news);
                    dc.SubmitChanges();
                }
                catch (Exception ex)
                {
                    throw WarnFactory.CreateWarn(ex);
                }

                WarnFactory.CreateWarn(new PageWarnParameter()
                {
                    JscriptMode = true,
                    AlertPage = "",
                    Message = "提交成功",
                     Link= WarnLink.Current,
                }).Alert();


            }

        }

 
    }
}